var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost:27017/QuQuMusicDB')

mongoose.connection.on('open',()=>{
    console.log('success');
}).on('error',()=>{
    console.log('fail');
})

// 用户表
var userSchema = new mongoose.Schema({
    name:String,
    psw:String,
    pic:String
})

var User = mongoose.model('user',userSchema)

// 收藏表 

var collectSchema = new mongoose.Schema({
    sid:Number,
    song:String,
    userinfo:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'user'
    }
})

var Collect = mongoose.model('collect',collectSchema)


module.exports = {User,Collect}
